const roleModel = require("../model/roleModel")

module.exports = {
    getList() {
        return roleModel.find()
    },
    update(id, { roleName, rights }) {
        // console.log(id, roleName, rights)
        return roleModel.findOneAndUpdate({ _id: id }, {
            $set: {
                roleName: roleName,
                rights: rights
            }
        })
    },
    delete(data) {
        console.log(data.id)
        return roleModel.findOneAndDelete({ _id: data.id })
    }
}